# Importing Data
QATAR<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Steel/TSA.xlsx",sheet = "Sheet1", range = "AA1:AA239")

# Checking the Imported Data
View(QATAR)
# Creating Time Series Data
QATAR_ts <- ts(QATAR, start=c(2000,1), end=c(2019,09), frequency=12)
# Viewing and Checking the Created Time Series Data
QATAR_ts
sum(is.na(QATAR_ts))
library(forecast)
QATAR_ts <- tsclean(QATAR_ts)
QATAR_ts

# Identification: Plotting the Time Series Data
plot(QATAR_ts)

# Estimating the appropriate model
QATAR_ts_model <- auto.arima(QATAR_ts)
QATAR_ts_model

# Forecasting
options(max.print=1000000)
QATAR_ts_forecast <- forecast (QATAR_ts_model, level=c(95), h=255)
plot(QATAR_ts_forecast)
QATAR_ts_forecast             

# Exporting
write.table(QATAR_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Steel/QATAR_TSA.csv", sep=",")
